package com.ciwong.epaper.widget;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ciwong.epaper.R;
import com.ciwong.epaper.modules.epaper.util.EpaperJumpManager;
import com.ciwong.epaper.util.DoubleClickCheckUtils;
import com.ciwong.epaper.util.RequestCode;


/**
 * Created by keepon on 2018/8/7.
 */
public class SearchItemView extends RelativeLayout{


	private TextView mTvTypeName;
	private RelativeLayout     mSearchContainer;
	private Context mContext;

	public SearchItemView(Context context) {
		this(context, null);
	}

	public SearchItemView(Context context, AttributeSet attrs) {
		this(context, attrs, 0);
	}

	public SearchItemView(Context context, AttributeSet attrs, int defStyleAttr) {
		super(context, attrs, defStyleAttr);
		mContext = context;
		LayoutInflater.from(this.getContext()).inflate(R.layout.layout_book_desk_search, this);
		init();
		initEvent();

	}



	private void init() {
		mTvTypeName = findViewById(R.id.tv_type_name);
		mSearchContainer = findViewById(R.id.rl_search_container);
		mSearchContainer.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if(DoubleClickCheckUtils.vertify500Duration()){
					EpaperJumpManager.jumpToSerachBook(R.string.go_back, (Activity) mContext, RequestCode.BookDeskResquestCode.REQ_CODE_TO_SEARCH_BOOK);
				}
			}
		});
	}

	private void initEvent() {

	}

}
